package com.lengtouzai.databaseexp.entity;

import io.jmix.core.entity.annotation.JmixGeneratedValue;
import io.jmix.core.metamodel.annotation.InstanceName;
import io.jmix.core.metamodel.annotation.JmixEntity;
import jakarta.persistence.*;

import java.time.LocalDateTime;
import java.util.UUID;

@JmixEntity
@Table(name = "EXP_REMARK", indexes = {
        @Index(name = "IDX_EXP_REMARK_TO_JOURNAL", columnList = "TO_JOURNAL_ID"),
        @Index(name = "IDX_EXP_REMARK_TO_REMARK", columnList = "TO_REMARK_ID"),
        @Index(name = "IDX_EXP_REMARK_BELONGS", columnList = "BELONGS_ID")
})
@Entity(name = "exp_Remark")
public class Remark {
    @InstanceName
    @JmixGeneratedValue
    @Column(name = "ID", nullable = false)
    @Id
    private UUID id;

    @Column(name = "VERSION", nullable = false)
    @Version
    private Integer version;

    @JoinColumn(name = "TO_JOURNAL_ID")
    @ManyToOne(fetch = FetchType.LAZY)
    private Journal toJournal;

    @JoinColumn(name = "TO_REMARK_ID")
    @ManyToOne(fetch = FetchType.LAZY)
    private Remark toRemark;

    @JoinColumn(name = "BELONGS_ID")
    @ManyToOne(fetch = FetchType.LAZY)
    private User belongs;

    @Column(name = "CONTENT")
    private String content;
    @Column(name = "CREATED_AT")
    private LocalDateTime createdAt;

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public User getBelongs() {
        return belongs;
    }

    public void setBelongs(User belongs) {
        this.belongs = belongs;
    }

    public Remark getToRemark() {
        return toRemark;
    }

    public void setToRemark(Remark toRemark) {
        this.toRemark = toRemark;
    }

    public Journal getToJournal() {
        return toJournal;
    }

    public void setToJournal(Journal toJournal) {
        this.toJournal = toJournal;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public UUID getId() {
        return id;
    }

    public void setId(UUID id) {
        this.id = id;
    }
}